package net.khoroshev.dveri.dao;

import net.khoroshev.dveri.domain.NewsArticle;

import com.googlecode.objectify.ObjectifyFactory;

public class NewsDao extends BaseDao<NewsArticle>{

	private final static NewsArticle EXAMPLE = new NewsArticle();
	
	public NewsDao(ObjectifyFactory ofyf) {
		super(ofyf);
	}

	public Iterable<NewsArticle> getLast(int num) {
		return ofyf.begin()
				.load().type(NewsArticle.class)
				.limit(num).order("-created");
	}

	@Override
	protected NewsArticle getObjectExample() {
		return EXAMPLE;
	}
}
